
ac.skill('咖喱棒'){
    temp = '攻击触发',
    odds = 15,
    cool = 4,
    rate = 1.0,
    model1 = [[AZ_Z011.mdl]],
    on_run = function(self,hero,target)
        local point1 = hero:get_point()
        local point2 = target:get_point()
        local angle = point2 / point1
        local range = point1 * point2
        if math.random(2)==1 then
            point1 = point2  - {angle + 30,range + 400}
        else
            point1 = point2  - {angle - 30,range + 400}
        end
        angle = point1 / point2
        local effect = hero:create_shadow(point1,angle,3)
        ac.wait(200,function()
            point1:effect{
                hide_when_remove = true,
                model = self.model1,
                angle = angle,
                height = 100,
                time = 2.8,
            }
        end)
        local lock = {}
        local damage = hero:get('攻击') * 0.5 * self.rate
        ac.timer(250,6,function()
            effect:play_animation('attack')
            hero:line_damage(point1,angle,1500,200,damage,self,function(unit)
                if lock[unit.handle] and (lock[unit.handle]-ac.clock()>0) then
                    return true
                end
                lock[unit.handle] = ac.clock() + 500
            end)
        end)
    end,
}

ac.skill('EX咖喱棒'){
    temp = '攻击触发',
    odds = 15,
    cool = 1,
    rate = 2.0,
    model1 = [[edac76db6bbac156fa4273bfca392101.mdl]],
    on_run = function(self,hero,target)
        local point1 = hero:get_point()
        local point2 = target:get_point()
        local angle = point2 / point1
        local range = point1 * point2
        if math.random(2)==1 then
            point1 = point2  - {angle + 30,range + 400}
        else
            point1 = point2  - {angle - 30,range + 400}
        end
        angle = point1 / point2
        local effect = hero:create_shadow(point1,angle,3)
        ac.wait(200,function()
            local point = point1 - {angle,400}
            point:effect{
                hide_when_remove = true,
                model = self.model1,
                angle = angle,
                height = 100,
                time = 2.8,
            }
        end)
        local lock = {}
        local damage = hero:get('攻击') * 0.5 * self.rate
        ac.timer(250,6,function()
            effect:play_animation('attack')
            hero:line_damage(point1,angle,3000,200,damage,self,function(unit)
                if lock[unit.handle] and (lock[unit.handle]-ac.clock()>0) then
                    return true
                end
                lock[unit.handle] = ac.clock() + 500
            end)
        end)
    end,
}


ac.skill('红莲斩'){
    temp = '攻击触发',
    odds = 12,
    cool = 4,
    model1 = [[BWJN_hlz.mdl]],
    rate = 1.5,
    on_run = function(self,hero,target)
        local point1 = hero:get_point()
        local point2 = target:get_point()
        local angle = point1 / point2
        local mover = point1:launch_wave(self.model1,angle,1200,(point1 * point2) + 500)
        local damage = hero:get('攻击') * self.rate
        sc.loopUnit(0.03,mover,150,function(group,unit)
            if unit:is_enemy(hero) then
                hero:create_damage(unit,damage,self)
            end
        end)

        function mover.on_remove(mover)
            ac.wait(200,function()
                self:notify('on_mover_remove',mover:get_point())
            end)
        end
    end,
}

ac.skill('红莲奥义斩'){
    temp = '红莲斩',
    model2 = [[BWJN_hlayz.mdl]],
    rate = 3,
    cool = 2,
    on_mover_remove = function(self,point)
        local hero = self.owner
        local damage = hero:get('攻击') * 5
        local lock = {}
        for a=1,6 do
            local mover = point:launch_wave(self.model2,a*60,1200,600)
            sc.loopUnit(0.03,mover,150,function(group,unit)
                if unit:is_enemy(hero) then
                    hero:create_damage(unit,damage,self)
                end
            end):set_lock(lock)
        end
    end,
}

ac.skill('残缺剑诀'){
    temp = '攻击触发',
    odds = 15,
    cool = 4,
    model1 = [[BWJN_FJ.mdl]],
    on_run = function(self,hero,target)
        local group = ac.selector('unit'):range(target,400):is_not(target):enemy(hero):get(4)
        local damage = hero:get('攻击') * 3
        table.insert(group,target)
        for _,unit in ipairs(group) do
            local point = unit:get_point() - {math.random(360),500}
            point.z = 150
            point:launch_missile(unit,self.model1,2400,0,function()
                hero:create_damage(unit,damage,self)
            end)
        end
    end,
}

ac.skill('天罡剑诀'){
    temp = '攻击触发',
    odds = 15,
    cool = 5,
    model1 = [[BWJN_FJ.mdl]],
    model2 = [[282.mdl]],
    on_run = function(self,hero,target)
        local point = target:get_point()
        local damage = hero:get('攻击') * 1
        local lock = {}
        point:effect{
            model = self.model2,
            size = 1.8,
            time = 1.5,
        }
        ac.timer(30,50,function()
            local p1 = point:random(300)
            local r = p1/point
            local p2 = p1 - {r,900}
            if math.random(2)==1 then
                p2:launch_wave(self.model1,r + 180,2400,900,nil,150)
            else
                p2:launch_wave(self.model1,r + 180,2400,900,nil,150)
            end
            
            hero:aoe_damage(point,300,damage,self,function(unit)
                if lock[unit.handle] and (lock[unit.handle]-ac.clock()>0) then
                    return true
                end
                lock[unit.handle] = ac.clock() + 500
            end)
        end)
    end,
}


ac.skill('龙息'){
    temp = '攻击触发',
    odds = 15,
    cool = 4,
    model1 = [[BWJN_lx.mdl]],
    on_run = function(self,hero,target)
        local point1 = hero:get_point()
        local point2 = target:get_point()
        local angle = point1 / point2
        local damage = hero:get('全属性') * 1
        point1:effect{
            model = self.model1,
            angle = angle,
        }
        local count = 0
        local lock = {}
        ac.loop(50,function(t)
            count = count + 1
            if count>=10 then
                t:remove()
            end
            hero:sector_damage(point1,count*100,angle,60,damage,self,lock)
        end):on_timer()
    end,
}

ac.skill('喷射吐息'){
    temp = '攻击触发',
    odds = 15,
    cool = 4,
    model1 = [[Abilities\Weapons\PhoenixMissile\Phoenix_Missile.mdl]],
    model2 = [[93d0862948b1658e629b0f34aeece527.mdl]],
    on_run = function(self,hero,target)
        local point1 = hero:get_point()
        local point2 = target:get_point()
        local angle = point1 / point2
        local point3 = point1 - {angle,-600}
        local point4 = point3 - {angle,600}
        local unit = ac.player[16]:create_unit('[动画]龙',point3,angle)
        local old_point = unit.get_impact_point
        unit.get_impact_point = function(u)
            local point = old_point(u)
            local angle = u:get_facing()
            return point - {angle,150}
        end

        local sd = ac.lightning({
            id = 'SRAY',
            from = unit,
            to = point4,
            ozf = 300,
        })
        local lock = {}
        local damage = hero:get('全属性') * 2
        ac.mover('line'){
            start = point3,
            angle = angle,
            mover = unit,
            speed = 1200,
            distance = 2400,
            super = true,
            need_remove_mover = true,
            on_move = function(p,b)
                local point = unit:get_point() - {angle,600}
                point.z = point3:get_height()
                sd.to = point
                point:add_effect(self.model1):remove()
                hero:aoe_damage(point,120,damage,self,lock)
            end,
            on_remove = function()
                sd:remove()
            end
        }
    end,
}


ac.skill('高温蒸汽'){
    temp = '挨打触发',
    odds = 10,
    cool = 4,
    model1 = [[158.mdl]],
    on_run = function(self,hero)
        local point = hero:get_point()
        local damage = hero:get('攻击') * 3
        point:effect{
            model = self.model1,
            size = 0.4,
        }:remove()
        hero:aoe_damage(point,450,damage,self)
    end,
}


ac.skill('终结者'){
    temp = '召唤单位',
    summon_unit = '召唤物-终结者',
    cool = 1,
    summon_time = 10,
    on_add = function(self)
        local hero = self.owner
        self:gc(hero:event '单位-攻击命中'(function(_,_,target)
            if self:is_cooling()==false and odd_run(15) then
                self:active_cd()
                self:notify('on_run',hero,target)
            end
        end))
    end,
    chek_summon = function(self,group)
        local has_count = 0
        for _,unit in ipairs(group) do
            if unit:is_alive() then
                has_count = has_count + 1
            end
        end
        return has_count>=3
    end,
    set_summon = function(self,unit)
        local hero = self.owner
        unit.title = '终结者'
        unit.owner_unit = hero
        jass.SetUnitAcquireRange(unit.handle, 1500)
        unit:set('攻击间隔',hero:get('攻击间隔'))
        unit:set('基础攻击',hero:get('攻击') * 1)
        unit:set('攻击速度',hero:get('攻击速度'))
        unit:set('生命上限',hero:get('生命上限')*0.4)
        unit:set('基础护甲',hero:get('护甲'))
    end,
}